package com.xyz;

import java.util.EnumSet;

public class User {
	
	public enum Permission {
		ADMIN, MANAGER, CALL_CENTRE;
	}
	
	private String login;
	private String pass;
	private UserType userType;
	private EnumSet<Permission> permissions;
	
	
	
	public String getLogin() {
		return login;
	}
	public void setLogin(String login) {
		this.login = login;
	}
	public String getPass() {
		return pass;
	}
	public void setPass(String pass) {
		this.pass = pass;
	}
	public UserType getUserType() {
		return userType;
	}
	public void setUserType(UserType userType) {
		this.userType = userType;
	}
	public EnumSet<Permission> getPermissions() {
		return permissions;
	}
	public void setPermissions(EnumSet<Permission> permissions) {
		this.permissions = permissions;
	}
	
	public User(){}
	
	public User(String login, String pass, UserType userType){
		this.login=login;
		this.pass=pass;
		this.userType=userType;
		if (userType.equals(UserType.admin))
			this.setPermissions(EnumSet.of(User.Permission.ADMIN));
		else if (userType.equals(UserType.callCenter))
			this.setPermissions(EnumSet.of(User.Permission.CALL_CENTRE));
		else
			this.setPermissions(EnumSet.of(User.Permission.MANAGER));
	}
	
}


